/**
 * @file contests/cf1698/b/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/10 15:03:19
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 2e5 + 10;
int a[N];
int main() {
  // High rating and good luck!
  int tc;
  cin >> tc;
  while (tc--) {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) cin >> a[i];
    if (k != 1) {
      int nTooTall = 0;
      for (int i = 1; i < n - 1; ++i)
        if (a[i] > a[i - 1] + a[i + 1]) nTooTall++;
      cout << nTooTall << endl;
    } else {
      cout << (n - 1) / 2 << endl;
    }
  }
  return 0;
}
